﻿using System;
using AutoMapper;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using NetMicro.Cache;
using NetMicro.Core.Ioc.Attributes;

namespace NetMicro.Applications
{
    /// <summary>
    /// 应用层基类
    /// </summary>
    public abstract class ApplicationBase : IApplicationBase
    {
        /// <summary>
        /// 配置
        /// </summary>
        [Dependency]
        public IConfiguration Configuration { protected get; set; }
        /// <summary>
        /// 内存缓存
        /// </summary>
        [Dependency]
        public IInMemoryCache MemoryCache { protected get; set; }
        /// <summary>
        /// 日志工厂
        /// </summary>
        [Dependency]
        public ILoggerFactory LoggerFactory { protected get; set; }

        /// <summary>
        /// automapper
        /// </summary>
        [Dependency]
        public IMapper Mapper { protected get; set; }
        /// <summary>
        /// 日志
        /// </summary>

        public ILogger Logger { get { return LoggerFactory.CreateLogger(this.GetType()); } }

    }
}
